#!/usr/bin/env python
# -*-coding:utf-8-*-
# File    : liyuqi.py
# Date    : 2021-02-05
# Author  : Tom.Lee

import requests

url = "https://testpassport.rabbitpre.com/api/sso/login"
params = {"account":"xxx","password":"xxx","fromType":"pc"}

sess = requests.session()
resp = sess.post(url, json=params, verify=False)
print(resp.text)

if resp.json().get("errorCode") == "SUCCESS":
    print("登录成功")
else:
    print("登录失败")


bws_url = "https://bws.test.rabbitpre.com/api/user"
resp = sess.get(bws_url, verify=False)
# print(resp.text)

home_url = "https://home.test.rabbitpre.com/api/workbench/org/getCompanyInfo"
resp = sess.get(home_url, verify=False)
# print(resp.text)
orgid = resp.json()["data"]["org_id"]
userid = resp.json()["data"]["org_user"]

print(userid)
print(orgid)